package com.vne.skyemart.model;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "CategoriesProduct",catalog = "skyemart_db")
public class CategoriesProduct implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 8033590003679148089L;
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "BrandID",nullable = false)
	private Brand brand;
	
	@Id
	@Column(name = "CategoryID",nullable = false,unique = true)
	private int categoryID;
	
	
	@Column(name = "Title",nullable = false,length = 50)
	private String title;
	
	@Column(name = "Description",length = 250)
	private String description;	
	
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "categoriesProduct")
	private Set<Products> products = new HashSet<Products>(0);
	/**
	 * CONSTRUCTOR
	 * 
	 */
	public CategoriesProduct() {}
	
	public CategoriesProduct(Brand brand, int categoryID, String title,
			String description, Set<Products> products) {
		super();
		this.brand = brand;
		this.categoryID = categoryID;
		this.title = title;
		this.description = description;
		//this.products = products;
	}
	/**
	 * GETTER AND SETTER
	 * 
	 */
	public Brand getBrand() {
		return brand;
	}
	public void setBrand(Brand brand) {
		this.brand = brand;
	}
	public int getCategoryID() {
		return categoryID;
	}
	public void setCategoryID(int categoryID) {
		this.categoryID = categoryID;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public Set<Products> getProducts() {
		return products;
	}
	public void setProducts(Set<Products> products) {
		this.products = products;
	}
	public static long getSerialversionuid() {
		return serialVersionUID;
	}
}
